package com.iss.ljx.department.service.impl;

import com.iss.ljx.department.entity.DepartmentEntity;
import com.iss.ljx.department.repository.DepartmentDao;
import com.iss.ljx.department.service.DepartmentService;
import com.iss.ljx.mybatis.flexigrid.PadingRstType;
import com.iss.ljx.mybatis.flexigrid.PagingBean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("DepartmentService")
public class DepartmentServiceImpl implements DepartmentService {
    @Resource
    private DepartmentDao departmentDao;

    @Override
    public PadingRstType<DepartmentEntity> selectAll(PagingBean paging) {
        PadingRstType<DepartmentEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(paging.getPage());
        List<DepartmentEntity> list = departmentDao.selectAll(paging);
        Integer total = departmentDao.Total();
        padingRstType.setRawRecords(list);
        padingRstType.setTotal(total);
        padingRstType.putItems();
        return padingRstType;
    }

    @Override
    public DepartmentEntity selectOneByBranchName(String branchName) {
        return departmentDao.selectOneByBranchName(branchName);
    }

    @Override
    public void deleteById(String depUuid) {
        departmentDao.deleteById(depUuid);
    }

    @Override
    public void insert(String depUuid, String organUuid, String branchName, String belongCenter,String modifierId, String modTime,  String remark) {
        departmentDao.insert(depUuid,organUuid, branchName, belongCenter,modifierId, modTime, remark);
    }

    @Override
    public void update(String depUuid,String organUuid, String branchName, String belongCenter,String modifierId, String modTime,  String remark) {
        departmentDao.update(depUuid,organUuid,branchName, belongCenter,modifierId, modTime, remark);
    }




}

